function saveStorage(key, value, module) {
	if (module) {
		let obj = uni.getStorageSync(module)
		if (!obj) {
			obj = {}
		}
		obj[key] = value
		uni.setStorageSync(module, obj)
	} else {
		uni.setStorageSync(key, value)
	}
}

function getStorage(key, module) {
	if (module) {
		const value = uni.getStorageSync(module)
		if (value && value[key]) {
			return value[key];
		}
	} else {
		return uni.getStorageSync(key)
	}
}

function removeStorage(key, module) {
	if (module) {
		const value = uni.getStorageSync(module)
		if (value && value[key]) {
			delete value[key];
		}
		saveStorage(key, value, module)
	} else {
		uni.removeStorageSync(key)
	}
}


export default {
	saveStorage,
	getStorage,
	removeStorage
}
